<?php

// +----------------------------------------------------------------------
// | 属性数据表
// +----------------------------------------------------------------------

namespace common\model;

use think\model\RelationModel;
use think\module\Module;

class GlobalNoticeModel extends RelationModel
{
    const GLOBAL_NOTICE_TYPE_DRAMA = 1;
    const GLOBAL_NOTICE_TYPE_PLAN = 2;
    const GLOBAL_NOTICE_TYPE_QUALITY_CONTROL = 3;
    const GLOBAL_NOTICE_TYPE_ABNORMAL = 4;
    const GLOBAL_NOTICE_TYPE_SEAL = 5;
    const GLOBAL_NOTICE_TYPE_UNSEAL = 6;
    const GLOBAL_NOTICE_TYPE_DAILY = 7;
    const GLOBAL_NOTICE_TYPE_SYSTEM = 8;
    const GLOBAL_NOTICE_TYPE_QA = 9;

    //自动验证
    protected $_validate = [
        ['title', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],
        ['type', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],
        ['is_top', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],
        ['type', [1, 2, 3, 4, 5, 6, 7, 8, 9], '', self::EXISTS_VALIDATE, 'in'], // 1:戏剧调整 2:排期调整 3:质检报告 4:异常需求 5:成片封板 6:成片解封 7:每日报表 8:系统公告 9:QA预警
        ['is_top', [0, 1], '', self::EXISTS_VALIDATE, 'in'], // 是否置顶 0:否 1:是
        ['json', '', '', self::EXISTS_VALIDATE, 'array'],
    ];

    protected $_auto = [
        ['summary', 'fill_text_default_val', self::MODEL_INSERT, 'function'],
        ['json', 'json_encode', self::MODEL_INSERT, 'function'],
        ['created_by', 'fill_created_by', self::MODEL_INSERT, 'function'],
        ['created', 'time', self::MODEL_INSERT, 'function'],
    ];
}
